package com.chuan.demo03;

//静态代理
public class StaticProxy {
    public static void main(String[] args) {
        new Thread(() -> System.out.println("love")).start();
        new WeddingCompany(new You()).HappyyMarry();
    }
}

interface Marry{

    void HappyyMarry();
}

//真实角色
class You implements Marry{
    @Override
    public void HappyyMarry() {
        System.out.println("我们结婚了");
    }
}
//代理角色
class WeddingCompany implements Marry{
    private Marry target;
    public WeddingCompany(Marry target){
        this.target = target;
    }

    @Override
    public void HappyyMarry() {
        before();
        this.target.HappyyMarry();
        after();
    }

    private void before() {
        System.out.println("婚前布置");
    }

    private void after() {
        System.out.println("婚后洞房");
    }
}